﻿#include "TcpThread.h"

#include "TcpIOer.h"
#include "qdebug.h"
TcpThread::TcpThread()
{

}

TcpThread::~TcpThread()
{

}

void TcpThread::startNewTcp(qintptr socketDescriptor)
{
  this->socketDescriptor=socketDescriptor;
  start();
}

void TcpThread::run()
{
  TcpIOer* tcpIOer=new TcpIOer();
  tcpIOer->setSocketDescriptor(socketDescriptor,QTcpSocket::ConnectedState,QTcpSocket::ReadWrite);
  connect(tcpIOer,&TcpIOer::destroyed,[this](){exit();deleteLater();});
  emit signal_newTcpCreated(tcpIOer);
  exec();
}
